extends "ActionFather.gd"
#类似rpgmaker里的动画 播放特效和打击点等
func blow(dh,from,to,dmg):
	hitAnimationBase(dh,from,to,dmg,"blow",0.1,0.3)
	
func sword1(dh,from,to,dmg):
	hitAnimationBase(dh,from,to,dmg,"sword1",0.1,0.5)
func sword2(dh,from,to,dmg):
	hitAnimationBase(dh,from,to,dmg,"sword2",0.1,0.4)
func sword3(dh,from,to,dmg):
	hitAnimationBase(dh,from,to,dmg,"sword3",0.1,0.4)
func fire(dh,from,to,dmg):
	hitAnimationBase(dh,from,to,dmg,"fire",0.7,0.1)
func absorb(dh,from,to,dmg):
	hitAnimationBase(dh,from,to,dmg,"能量吸收",0.7,0.1)
func windSword(dh,from,toList,dmg):
	aoeAnimationBase(dh,from,toList,dmg,"旋风斩",0.2,0.2)


#--基础攻击动画模型
func hitAnimationBase(dh,from,to,dmg,ve,frontWait,backWait):
	if from.die|| to.die:
		return null
	
	BaseAction.VETarget(dh,ve,to)
	BaseAction.wait(dh,frontWait)
	BaseAction.damage(dh,from,to,dmg)
	BaseAction.wait(dh,backWait)
	
	
#--多人攻击动画模型
func aoeAnimationBase(dh,from,toList,dmg,ve,frontWait,backWait):
	if from.die:
		return null
	var dmgdh=[0]
	for to in toList:
		if to.die:
			pass
		else:
			BaseAction.damage(dmgdh,from,to,dmg)
	BaseAction.VEPoint(dh,ve,"enemy")
	BaseAction.wait(dh,frontWait)
	dh.append(dmgdh)
	BaseAction.wait(dh,backWait)